Skip to content

docs: allow classes and async/await in live examples#1543

Merged
cognite-bulldozer[bot] merged 6 commits into
masterfrom
mn/docs-better-react-live
Jun 23, 2021
Merged

docs: allow classes and async/await in live examples#1543
cognite-bulldozer[bot] merged 6 commits into
masterfrom
mn/docs-better-react-live

Conversation

@maksnester
Copy link
Copy Markdown
Contributor

basically, the fix for classes here is passing transpileOptions to LiveProvider as

    <LiveProvider
      code={children}
      transpileOptions={{
        transforms: {
          classes: false,
          asyncAwait: false
        }
      }}

but it's not supported in react-live (at least yet, but I made a PR hope to see it merged someday). Meanwhile, I just listed a github branch as a dependency so we can use it even before it's merged.

@maksnester maksnester requested a review from a team as a code owner June 22, 2021 13:54
@maksnester maksnester force-pushed the mn/docs-better-react-live branch from 1a6c826 to 1ab1472 Compare June 22, 2021 13:55
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 22, 2021

Codecov Report

Merging #1543 (36a51df) into master (002bff5) will increase coverage by 4.28%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #1543      +/-   ##
==========================================
+ Coverage   64.04%   68.32%   +4.28%     
==========================================
  Files          73      142      +69     
  Lines        1986     7079    +5093     
  Branches      166      775     +609     
==========================================
+ Hits         1272     4837    +3565     
- Misses        712     2236    +1524     
- Partials        2        6       +4     
Impacted Files Coverage Δ
viewer/src/views/threejs/pickPixelColor.ts
viewer/src/models/cad/determineSectors.ts
viewer/src/models/cad/CadModelImpl.ts
...rc/datasources/cognitesdk/CdfModelDataRetriever.ts
viewer/src/repository/cad/CachedRepository.ts
viewer/src/models/cad/CadBudget.ts
viewer/src/views/threejs/cad/MaterialManager.ts
viewer/src/threejs-internal.ts
...wer/src/views/threejs/cad/fromThreeCameraConfig.ts
...iewer/src/views/threejs/cad/consumeSectorSimple.ts
... and 203 more

@github-actions
Copy link
Copy Markdown

📙 Documentation preview is available from
https://cognitedata.github.io/reveal-docs-preview/1543/docs/next/.

@larsmoa
Copy link
Copy Markdown
Contributor

larsmoa commented Jun 23, 2021

Best. Thing. Ever

"npm-to-yarn": "^1.0.1",
"react": "^16.8.4",
"react-dom": "^16.8.4",
"react-live": "maksnester/react-live#mn/disable-transpilation-options-dist",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dafuc?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😂

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah. It's the branch ofc. Nice!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@larsmoa Fair question. You can specify github repo#branch instead of the version number. In that case, during installation the package node_modules/react-live will be downloaded from github repo instead of NPM. That's a temporary hack until PR will be merged. I didn't want to create a fork of react-live under org and maintain it and publish it under new name. I just want my patch to work.

Once my referenced PR to react-live will be merged I'll update it here with new patched react-live version.

@larsmoa larsmoa added auto-update do-not-merge Don't merge this PR yet. and removed auto-merge labels Jun 23, 2021
@larsmoa
Copy link
Copy Markdown
Contributor

larsmoa commented Jun 23, 2021

Approved, but hold the merge until I have released.

@maksnester maksnester added auto-merge and removed do-not-merge Don't merge this PR yet. labels Jun 23, 2021
@cognite-bulldozer cognite-bulldozer Bot merged commit 8f33ebb into master Jun 23, 2021
@cognite-bulldozer cognite-bulldozer Bot deleted the mn/docs-better-react-live branch June 23, 2021 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants